<?php
namespace Admin\Controller;
use Think\Controller;
class LoginController extends Controller{
	/*
	 * @discribe 登陆页面显示以及处理
	 * @param void
	 */
	function login () {	
		//登陆处理
		if(!empty($_POST)){
			unset($_POST['验证码']);
			$pdo =D('Admin');
			
			//防注入查找
			$re = $pdo->where("adminname='%s' and password='%s'",array($_POST['adminname'],$_POST['password']))->find();
			if($re){				
				$uid=$re['id'];
				$nicname=$re['nicname'];
				session('uid',$uid);
				session('nicname',$nicname);
				$this->redirect('Admin/Index/index');
			}else {
				$this->redirect('Admin/Login/login');
			}
		}
		$this->display();
	}
}